<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Common controller should have functions that would be in more than 1 of its children classes
 * Controller functions should end in Request
 * @author nstevens
 */
class commonController {

    public $model;

    public function __construct($model) {
        $this->model = $model;
    }

    public function editProfileRequest() {
        $this->model->string = $this->model->getEditProfilePage();
    }

    public function getHelpPageRequest() {
        $this->model->string = $this->model->getHelpPage();
    }

    public function processEditProfileRequest() {
        $url = $this->model->processEditProfile();
        if ($url) {
            echo header($url);
        } else {
            echo "error";
        }
    }

    /**
     * This is called when a PI or PI Reviewer adds notes to a project, task, o subtask
     */
    public function processAddNotesRequest() {
        $url = $this->model->addNotes();
        if ($url) {
            echo header($url);
        } else {
            echo "error";
        }
    }

    /*
     * Called when a PI is creating or editing a Task
     */

    public function processTaskSubmitRequest() {
        $url = $this->model->processTaskSubmit();
        if ($url) {
            echo header($url);
        } else {
            echo "error";
        }
    }

    /*
     * Called when a PI is creating or editing a SubTask
     */

    public function processSubtaskSubmitRequest() {
        $url = $this->model->processSubtaskSubmit();
        if ($url) {
            echo header($url);
        } else {
            echo "error";
        }
    }

}

?>
